﻿using System.Web.Profile;
using System.Web.Security;

namespace CodeStash.Models.Security
{
    public class UserSettingsProfileModel : ProfileBase
    {
        [SettingsAllowAnonymous(false)]
        public bool IsOpenIdLoggedInUser
        {
            get { return (bool)base["IsOpenIdLoggedInUser"]; }
            set { base["IsOpenIdLoggedInUser"] = value; }
        }

        [SettingsAllowAnonymous(false)]
        public int HighlightingCSSId
        {
            get { return (int)base["HighlightingCSSId"]; }
            set { base["HighlightingCSSId"] = value; }
        }

        [SettingsAllowAnonymous(false)]
        public int MaxSnippetsToDisplay
        {
            get { return (int)base["MaxSnippetsToDisplay"]; }
            set { base["MaxSnippetsToDisplay"] = value; }
        }

        public static UserSettingsProfileModel GetUserProfile(string username)
        {
            return Create(username) as UserSettingsProfileModel;
        }

        public static UserSettingsProfileModel GetUserProfile()
        {
            return Create(Membership.GetUser().UserName) as UserSettingsProfileModel;
        }
    }
}